#include "RTICommand.h"
#include <iostream>

using namespace std;
using namespace server;

RTICommand::RTICommand(void) {

}

RTICommand::~RTICommand(void) throw () {
}

RTICommand* RTICommand::newCommand(char* str) {

	return new CreateFederationExecutionCommand;
}

CreateFederationExecutionCommand::CreateFederationExecutionCommand(void) : RTICommand() {

}

CreateFederationExecutionCommand::~CreateFederationExecutionCommand(void) throw () {
}

void CreateFederationExecutionCommand::process() {
	extern void createFedEx(RTIambassador & rtiAmb,
		std::wstring const& fedName,
		std::wstring const& fedFile);
	// Federate and Federation info
	std::vector< std::wstring > args;
	std::wstring federationName(L"MAKsimple");
	std::wstring federationFile(L"MAKsimple.xml");
	std::wstring federateType(L"rtisimple1516");
	// RTI and Federate Ambassadors
	RTIambassadorFactory* rtiAmbFactory = new RTIambassadorFactory();
	std::auto_ptr < RTIambassador > rtiAmbAP =
		rtiAmbFactory->createRTIambassador(args);
	RTIambassador* rtiAmb = rtiAmbAP.release();

	// Create the federation
	createFedEx(*rtiAmb, federationName, federationFile);
}

